﻿import request from '/@/utils/request';
enum Api {
    AddBusGoods = '/api/busGoods/add',
    DeleteBusGoods = '/api/busGoods/delete',
    UpdateBusGoods = '/api/busGoods/update',
    PageBusGoods = '/api/busGoods/page',
    GetSysClassDropdown = '/api/busGoods/SysClassDropdown',
    GetBusProductDropdown = '/api/busGoods/BusProductDropdown',
    GetSysClassFlagDropdown = '/api/busGoods/SysClassFlagDropdown',
    GetBusAttributeDropdown = '/api/busGoods/BusAttributeDropdown',
    BusGoodsAttributeDropdown_Value = '/api/busGoods/BusGoodsAttributeDropdown_Value',
    GetBusAttributeDropdownQBM = '/api/busGoods/BusAttributeDropdown_QBM',
    GetBusGoodSupplier = '/api/busGoods/GetBusGoodSupplier',
    UpLoadFile = '/api/busGoods/UpLoadFile',
    ImportFile = '/api/busGoods/ImportFile',
    DownloadFile='/api/busGoods/DownloadFile',
}

// 增加商品管理
export const addBusGoods = (params?: any) =>
    request({
        url: Api.AddBusGoods,
        method: 'post',
        data: params,
    });

// 删除商品管理
export const deleteBusGoods = (params?: any) =>
    request({
        url: Api.DeleteBusGoods,
        method: 'post',
        data: params,
    });

// 编辑商品管理
export const updateBusGoods = (params?: any) =>
    request({
        url: Api.UpdateBusGoods,
        method: 'post',
        data: params,
    });

// 分页查询商品管理
export const pageBusGoods = (params?: any) =>
    request({
        url: Api.PageBusGoods,
        method: 'post',
        data: params,
    });

export const getSysClassDropdown = () =>
    request({
        url: Api.GetSysClassDropdown,
        method: 'get'
    });
export const GetSysClassFlagDropdown = (param?: any) =>
    request({
        url: Api.GetSysClassFlagDropdown,
        method: 'get',
        data: param
    });
export const getBusProductDropdown = () =>
    request({
        url: Api.GetBusProductDropdown,
        method: 'get'
    });

export const BusAttributeDropdown = (param?: any) =>
    request({
        url: Api.GetBusAttributeDropdown,
        method: 'get',
        data: param
    });
//BusGoodsAttributeDropdown_Value
export const BusGoodsAttributeDropdownValue = (param?: any) =>
    request({
        url: Api.BusGoodsAttributeDropdown_Value,
        method: 'get',
        data: param
    });
export const getBusAttributeDropdownF = (param?: any) =>
    request({
        url: Api.GetBusAttributeDropdownQBM,
        method: 'get',
        data: param
    });
export const getBusGoodSupplier = (param?: any) =>
    request({
        url: Api.GetBusGoodSupplier,
        method: 'get',
        data: param
    });

// 下载
export const upLoadFileGoods = (params?: any) =>
    request({
        url: Api.UpLoadFile,
        method: 'post',
        data: params,
    });

    // 下载 文件流
export const downloadFileGoods = (params?: any) =>
request({
    url: Api.DownloadFile,
    method: 'post',
    data: params,
});

// 导入上传
export const importFileGoods = (params?: any) =>
    request({
        url: Api.ImportFile,
        method: 'post',
        data: params,
        headers: { 'Content-Type': 'multipart/form-data' }
    });